import { Component, OnInit ,Input} from '@angular/core';
import {ApisService} from "../../services/requests/apis.service";
import {RequestsService} from "../../services/requests/requests.service";

@Component({
  selector: 'app-popover',
  templateUrl: './popover.component.html',
  styleUrls: ['./popover.component.scss']
})
export class PopoverComponent implements OnInit {

  @Input()
  cabinetId: any;

  cabinetGeneralInfo: any;

  private loading: boolean;

  private cabinetGeneralApi = this.apis.apis.cabinetGeneral;


  constructor(
    private apis: ApisService,
    private req: RequestsService
  ) { }

  private getCabinetGenera() {
    console.log("进入到获取数据了");
    this.loading = true;
    this.req.postData(this.cabinetGeneralApi,this.cabinetId)
      .subscribe(res=>{
        console.log("获取到的机柜信息");
        console.log(res);
        this.cabinetGeneralInfo = res;
        this.loading = false;
      },err=>{

      })
  }

  ngOnInit() {
  this.getCabinetGenera();
  }

}
